<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <title>确认交易</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="x-dns-prefetch-control" content="on" />
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/alertMsg.js"></script>
	<!-- 
	<link rel="dns-prefetch" href="http://static.paipaiimg.com" />
	 -->
	
    <link rel="stylesheet" href="{$Think.config.RESOURCEURL}wx_assets/css/buy.min.css?t=201401202125" />    
</head>
<body>
	<div class="mod_bar">
	    <div class="mod_bar_back">
	    	<a href="javascript:history.go(-1);"><i></i></a>
	    </div>
	    <div class="mod_bar_center">
	        <h1 class="mod_bar_tit">确认订单</h1>
	    </div>
	</div>
	<input type="hidden" id="vmReferer" value="http://pt.3g.qq.com/s?aid&#61;touchLogin&amp;t&#61;qqbuy&amp;bid_code&#61;qqbuyLogin&amp;loginTitle&#61;QQ%E7%BD%91%E8%B4%AD&amp;g_ut&#61;2&amp;go_url&#61;http%3A%2F%2Fm.buy.qq.com%2Fp%2Fcart%2Forder%2Fwxconfirm.xhtml%3Fbc%3D1%26g_tk%3D1348243540%26attr%3D%25E9%25A2%259C%25E8%2589%25B2%253A%25E9%25BB%2591%25E8%2589%25B2%2B%25E7%2581%25B0%25E8%2589%25B2%257C%25E5%25B0%25BA%25E7%25A0%2581%253A%25E5%259D%2587%25E7%25A0%2581%26_token%3D96F54F9BAB85%26g_ty%3Dls%26pgid%3D2-1%26ic%3DFFFF57AD0000000004010000368B6F5C" />
	<input type="hidden" id="baseParams" value="/?sid=ASKNbX7mewFTwjGQIzq3KuWS&amp;pgid=10-1&amp;_token=96F54F9BAB85" />
	<form action="/p/cart/order/wxmakeOrder.xhtml?sid=ASKNbX7mewFTwjGQIzq3KuWS&amp;pgid=10-1&amp;_token=96F54F9BAB85" method="post" id="orderForm">
		
		<div class="goods">
		
		<volist name="productList" id="product">
		<if condition="$i eq 1">
			<div class="goods_img">
		        <a href="">
		        	<img back_src="{$product.picUrl}" alt="{$product.name}">
				</a>
		    </div>
		    <div class="goods_name">
		        <a href="#">{$product.name}</a>
		    </div>
		    	
		    <notempty name="product.colorName">
		    	<div class="goods_attr">
		    		<span class="co_gray">颜色：</span><span>{$product.colorName}&nbsp;</span>
		    	</div>
		    </notempty>    
	    	
	    	
	    	<notempty name="product.sizeName">
			    <div class="goods_attr">
			    	<span class="co_gray">尺码：</span><span>{$product.sizeName}&nbsp;</span>
			    </div>
	    	</notempty>
	    	
		    <div class="goods_num_wrap">
		    	<span class="co_gray">数量：</span>
				<!-- 不可用时，增加class="goods_num_disabled"，不存在商品属性时，增加class="goods_num_static" -->
			    	<div class="goods_num">	    	
			        <span class="goods_num_txt" id="goodsNumTxt">{$product.reserveCount}</span>
			        <span class="goods_num_ico"></span>
					<select name="bc" id="orderItemCount" class="goods_num_select">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
					</select>	        
			    	</div>
			</div>
			
			<notempty name="product.fixedPrice">
			 	<div class="goods_price">
                   	<span class="co_gray">价格：</span>
		            <notempty name="product.discountedPrice">
			            <span class="co_red" style="margin-left:0;">&yen;
			            <b id="itemPrice" price="{$product['discountedPrice']}">{$product['discountedPrice'] * $product[reserveCount]}元</b>
			            </span>
	                <else />
			            <span class="co_red" style="margin-left:0;">&yen;
			            <b id="itemPrice" price="{$product['fixedPrice']}">{$product['fixedPrice'] * $product['reserveCount']}元</b>
			            </span>
		       		</notempty>
	       		</div>
           </notempty>
           <notempty name="product.points">&nbsp;&nbsp;
        		<div class="goods_price">
         				<if condition="$product.pointsType eq 'interact'">
         				
         					<span class="co_gray">互动积分：</span>
         				<else />
         					<span class="co_gray">消费积分：</span>
         				</if>
             			<span class="co_red" style="margin-left:0;">
		            		<b id="itemPrice" price="{$product.points}">{$product.points}积分</b>
		            	</span>
           		</div>
           </notempty>
			   
			   <!-- 
		   				<div class="goods_price">
		    			<span class="co_gray">微信价：</span>
		    	    	<span class="co_red" style="margin-left:0;">&yen;<b id="itemPrice" price="318.00">318.00</b></span>
		    			<span class="co_gray">（<span id="fareVal" price="0">免运费</span>）</span>
		   				 </div>
		   		 <div class="goods_price" style="display:none;" id="totPayPriceBlock">
		    	<span class="co_gray">应付金额：</span>
		    	<span class="co_red" style="margin-left:0;">&yen;<b id="totItemPrice"></b></span>
		    	</div>
			    -->
		    
		    <!-- 
		    <div class="goods_tips">
		        *因地址变动商品价格可能变化
		    </div>	    
		     -->
		     
		    <input type="hidden" name="stockCount" id="orderStockCount" value="4882" />
		    <input type="hidden" name="ic" id="orderItemCode" value="FFFF57AD0000000004010000368B6F5C" />
			<input type="hidden" name="attr" id="orderStockAttr" value="颜色:黑色 灰色|尺码:均码" />
			<input type="hidden" name="sellerUin" id="orderSellerUin" value="2908225535" />
			<input type="hidden" name="pt" id="orderPayType" value="2" />
			<input type="hidden" id="wxpay" name="wxpay" value="1" />
			<input type="hidden" name="mt" id="orderMt" value="0"/>
		
		
		</if>
		</volist>
		    
		</div>
		
		
		<div class="address">
			<div class="addform_address">
		        <div class="addform_item">
		            <span class="addform_tit">配送方式</span>
		            <select class="addform_select" name="sendTypeId" data-current="" id="sendType">
		           		
		           		<if condition="count($shipping) gt 1 && !$deliveryHasDefault">
		            		<option value="-1">请选择配送方式</option>
	                	</if>
		           		
		           		<volist name="shipping" id="shipping">
	                    	<if condition="($shipping.cost eq NULL) AND ($shipping.points eq NULL)">
	                    		<option value="{$shipping.value}" mtype="{$shipping.value}" ptype="0">{$shipping.text}</option>
	                    	<elseif  condition="$shipping.cost neq NULL"/>
	                    		<option value="{$shipping.value}" mtype="{$shipping.value}" ptype="0">{$shipping.text}： ￥{$shipping.cost}元</option>
	                    	<elseif  condition="$shipping.points neq NULL"/>
	                    		<option value="{$shipping.value}" mtype="{$shipping.value}" ptype="0">{$shipping.text}： {$shipping.points}积分</option>
	                    	</if>
                    	</volist>
		           		
		            </select>
		           
		        </div>
	    	</div>
		</div>
		<div class="address">
			<div class="addform_address">
		        <div class="addform_item">
		            <span class="addform_tit">支付方式</span>
		            <select class="addform_select" name="payTypeId" data-current="" id="payType">
		           		<if condition="count($payType) gt 1 && !$payTypeHasDefault">
		            		<option value="-1">请选择支付方式</option>
	                	</if>
	                	<volist name="payType" id="payType">
	                		<option value="{$payType.value}">{$payType.text}</option>
	                	</volist>
		            </select>
		        </div>
	    	</div>
		</div>
		<notempty name="address">
		 	<div class="address" id="toAddrList">
		 		<a  onclick="onAddress(this);">
		    		<div class="address_item" id="addressItem">
		    			<div class="address_tit">送至</div>
		    			<div class="address_cnt">
		    				<p class="address_info">{$address}</p>
		            		<p class="address_name"><b>{$phone}</b>，{$fullName}</p>
		        		</div>
		    		</div>
	    		</a>
	    		<a href="" id="addressBtn" class="address_ico">&gt;</a>
			</div>
			<input type="hidden" name="adid" id="addressId" value="1" />
	    <else />
	    	<div class="address address_add" id="toAddrList">
				<a  onclick="onAddress(this);">
	   				<div class="address_blank" >
	        		请填写收货地址
	    			</div>
				</a>
	   		 <a href="" id="addAddrBtn" class="address_ico">&gt;</a>
			</div>
			<input type="hidden" name="adid" id="addressId" value="0" />
		 </notempty>
		<div class="address" id="toStoreList">
			<a onclick="onStore(this)">
    			<div class="address_item" id="addressItem">
	    			<div class="address_cnt">
	            		<p class="address_name"><b>自提点名称：</b>{$lastBuyStoreName}</p>
	        		</div>
	    		</div>
			</a>
   		 <a href="" id="addAddrBtn" class="address_ico">&gt;</a>
		</div>
			
		<div id="buyBtns">
		<a href="javascript:;" class="btn_buy" id="surePayBtn">提交订单</a>
		</div>
		<!-- 
		<div id="buyBtns">
		<a href="javascript:;" class="btn_buy btn_buy_disabled" id="buyBtn">微信支付 不可用状态</a>
		</div>
		 -->
		
	</form>
	<div class="goods info_loading" id="loadingImg" style="display:none;">
    	订单信息生成中<i class="loading"></i>
	</div>

	
	<!-- 
	<div class="mod_tips mod_tips_hdfk" id="payTipsFloat" style="display:none;">
	    <div class="mod_tips_hd">
	        是否确认提交订单？
	    </div>
	    <div class="mod_tips_cnt">
	        <p>付款金额：&yen;<span id="tipsPriceTxt"></span></p>
	        <p id="tipsSevOuter"></p>
	    </div>
	    <div class="mod_tips_ft">
	        <a href="javascript:" class="btn_cancle btn_cancle_mini" id="cancelPayBtn">取消</a>
	        <a href="javascript:" class="btn_sure btn_sure_mini" id="surePayBtn">确认</a>
	    </div>
	</div>
	 -->
	
<script type="text/javascript" src="wx_assets/js/zepto.min.js"></script>
<script id="legos:21914" ver="21914:20131231:201403061451" name="PP.wx.buy" src="wx_assets/js/pp.wx.buy.20131231.js?v=20141209" charset="utf-8"></script>
<script id="legos:21948" ver="21948:20140122:20140218130348" name="PP.wg.mobilereport" src="wx_assets/js/pp.wg.mobilereport.20140122.js?t=20140218130348" charset="gbk"></script>
<script type="text/javascript">
  var objMsg = {p:"paipai.com",weixin:1};
  ECC.cloud.report.pv(objMsg);
</script>
<script>window["PP.mobile.ping.time"]=[new Date()]</script>
<script id="legos:21922" ver="21922:20140103:20140106154115" name="PP.mobile.ping" src="wx_assets/js/pp.mobile.ping.20140103.js?t=20140106154115" charset="gbk"></script>

<script>
var hrefParamsArray = GetSessionIdFromHref(window.location.search);
hrefParamsArray["userName"]='{$userName}';
function GetSessionIdFromHref(search){
　　	var args = search.substring(1); 
　　	var retval = new Array(); 
	args = args.split("&"); 
		for(var i = 0; i < args.length; i ++){ 
			str = args[i]; 
			var arg = str.split("="); 
			if(arg.length <= 1) continue; 
			
			if(arg[0] == 'params') {
				var params = decodeURIComponent(arg[1]);
				var obj = eval('(' + params + ')');
				if (obj.rootid != undefined) {
					retval["rootid"] = obj.rootid;
				}
				if (obj.start != undefined) {
					retval["start"] = obj.start;
				}
				if (obj.tplid != undefined) {
					retval["tplid"] = obj.tplid;
				}
				if (obj.ptype != undefined) {
					retval["ptype"] = obj.ptype;
				}
				if (obj.dtype != undefined) {
					retval["dtype"] = obj.dtype;
				}
				retval["id"] = obj.id;
			} else if(arg[0] == 'customerId') {
				retval["customerId"] = arg[1]; 
			}else if(arg[0] == 'userName'){
				retval["userName"] = arg[1]; 
			} else if(arg[0] == 'method') {
				retval["method"] = arg[1];
			}
		} 
		
		if (retval["start"] == undefined) {
			retval["start"] = 0;
		}
		return retval; 
}

var hrefPath = 'call.html?customerId='+ hrefParamsArray["customerId"]+'&userName='+hrefParamsArray["userName"];
var basePath = 'call.json?customerId='+ hrefParamsArray["customerId"]+'&userName='+hrefParamsArray["userName"];
var rootId = hrefParamsArray["rootid"] == undefined ? '' : ',"rootid":' + hrefParamsArray["rootid"];
//var preOid = hrefParamsArray["oid"];
var tplid = hrefParamsArray["tplid"];
var id =  hrefParamsArray["id"] == undefined ? '' : hrefParamsArray["id"];

function onAddress(ctrl) {
	var payType = $("#payType").val();
/*
	if(payType == 'wxpay'){

	  	var baseUrl =  '{$Think.config.SERVER_HOST}';
	 	var urlString = baseUrl + 'call.json?customerId='+ hrefParamsArray["customerId"]+'&userName='+hrefParamsArray["userName"];
	 	var curUrl = window.location.href;
	 	
	 	curUrl = encodeURIComponent(curUrl);
	 	$.ajax({url : urlString,
	 		dataType : "json",
	 		type : "post",
	 		timeout: 15000,
	 		data : {
	 			'module': 'product',
	 	        'method' : 'getAddrSign',
	 	        'params' : '{"url":"' + curUrl + '"}'
	 	    	},
	 		success : function(data) {
	 			//console.log(data);
	 			//console.log(typeof(data.code));
	 			if (typeof(data.code) == 'undefined' ) {
	 				try{
	 					WeixinJSBridge.invoke('editAddress',data,function(res){
		 					if(res == null || res == ''){
		 					}else{
			 					document.form1.address1.value = res.proviceFirstStageName;
			 					document.form1.address2.value = res.addressCitySecondStageName;
			 					document.form1.address3.value = res.addressCountiesThirdStageName;
			 					document.form1.detail.value = res.addressDetailInfo;
			 					document.form1.phone.value = res.telNumber;
		 					}
		 				});
	 				}
	 				catch(e){
	 					alert('操作失败，请确保在微信浏览器中操作');
	 				}
	 			}else{
	 				alert(data.msg);
	 				return false;
	 			}
	 			
	 			//window.location.href = 'call.html?userName=' + hrefParamsArray['userName'] + '&customerId='
	 			//+ hrefParamsArray['customerId'] + '&module=product&method=getOrderDetail&params={"tplid":'+hrefParamsArray['tplid']+',"id":' + data.id + rootid + '}';
	 		},
	 		 error: function(jqXHR, textStatus, errorThrown){
	 			 alert('发送超时,可能存在网络异常,检查后请重试...');
	 			 return false;
	 				//$("#showcard").val("保 存");
	 				//$("#showcard").attr("disabled", false);
	 	     }
	 });
	 	
		return ;
	} */
	
	var id= hrefParamsArray["id"];
	var rootid = '';
	if (hrefParamsArray["rootid"] !== undefined) {
		rootid = ',"rootid":' + hrefParamsArray["rootid"];
	}

	var ptype = '';
	if (payType != -1) {
		ptype = ',"ptype":"' + payType + '"';
	}
	var dtype = '';
   	var a = $("#sendType")[0];
    var curMtype = a.options[a.selectedIndex].getAttribute("mtype");
	if (curMtype != -1) {
		dtype = ',"dtype":"' + curMtype + '"';
	}
	
	ctrl.href = 'call.html?userName=' + hrefParamsArray['userName'] + '&customerId='
	+ hrefParamsArray['customerId'] + '&module=product&method=getAddr&params={"tplid":2,"oid":' + id + rootid + ptype + dtype + '}';
}
function onStore(ctrl) {
	var id= hrefParamsArray["id"];
	var rootid = '';
	if (hrefParamsArray["rootid"] !== undefined) {
		rootid = ',"rootid":' + hrefParamsArray["rootid"];
	}

	var param = id == '' ? '' : ',"oid":' + id;

	var ptype = '';
	var payType = $("#payType").val();
	if (payType != -1) {
		ptype = ',"ptype":"' + payType + '"';
	}
	var dtype = '';
   	var a = $("#sendType")[0];
    var curMtype = a.options[a.selectedIndex].getAttribute("mtype");
	if (curMtype != -1) {
		dtype = ',"dtype":"' + curMtype + '"';
	}
	
	ctrl.href = 'call.html?userName=' + hrefParamsArray['userName'] + '&customerId='
	+ hrefParamsArray['customerId'] + '&module=product&method=getPickupStore&params={"tplid":2' + param + rootid + '}';
}
</script>

<script type="text/javascript">
    var fullName = '{$fullName}';
    var phone = '{$phone}';
    var address = '{$address}';
    var sid = '{$lastBuyStoreId}';
    
    var type, totalPrice;
    
    if (hrefParamsArray["ptype"] !== undefined) {
    	$('#payType').val(hrefParamsArray["ptype"]);
    }
    if (hrefParamsArray["dtype"] !== undefined) {
    	var dcount = $("#sendType")[0].options.length;
    	for (var i = 0; i < dcount; i++) {
    		if ($("#sendType")[0].options[i].getAttribute('mtype') == hrefParamsArray["dtype"]) {
    			$("#sendType")[0].options[i].selected = true;         
    			break; 
    		}
    	}
    }
	
   	if ('{$price}' !== '' && ('{$points}' == '' || '{$points}' == '0')) {
   		type = 'buy';
   		totalPrice =  parseFloat('{$price}') * 100;
   	} else {
   		type = 'point';
   		totalPrice = parseFloat('{$points}');
   	}
   	PP.wx.buy.init();
</script>



<script type="text/javascript">
$(function(){
	var imageUrl = '{$productList[0].picUrl}';
	var title = '{$productList[0].name}';
	var des = '点击这里查看商品';
	var pid =  '{$productList[0].id}';
	var shareUrlString ='{$Think.config.SERVER_HOST}' + 'call.html?customerId='+ hrefParamsArray["customerId"]+'&userName='+
			'&module=product&method=getProduct&params=%7B%22tplid%22:2,%22id%22:"' + pid + '"%7D';

	window.shareData = {
		"imgUrl": imageUrl,
		"timeLineLink":  shareUrlString ,
		"sendFriendLink":  shareUrlString ,
		"weiboLink":  shareUrlString ,
		"tTitle": title,
		"tContent": des,
		"fTitle": title,
		"fContent": des,
		"wContent": des
	};
	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
		// 发送给好友
		WeixinJSBridge.on('menu:share:appmessage', function (argv) {
			WeixinJSBridge.invoke('sendAppMessage', {
				"img_url":  window.shareData.imgUrl,
				"img_width": "640",
				"img_height": "640",
				"link": window.shareData.sendFriendLink,
				"desc": window.shareData.fContent,
				"title": window.shareData.fTitle
			}, function (res) {
				_report('send_msg', res.err_msg);
			})
		});
	
		// 分享到朋友圈
		WeixinJSBridge.on('menu:share:timeline', function (argv) {
			WeixinJSBridge.invoke('shareTimeline', {
				"img_url": window.shareData.imgUrl,
				"img_width": "640",
				"img_height": "640",
				"link": window.shareData.timeLineLink,
				"desc": window.shareData.tContent,
				"title": window.shareData.tTitle
			}, function (res) {
				_report('timeline', res.err_msg);
			});
		});
	
		// 分享到微博
		WeixinJSBridge.on('menu:share:weibo', function (argv) {
			WeixinJSBridge.invoke('shareWeibo', {
				"content": window.shareData.wContent,
				"url": window.shareData.weiboLink
			}, function (res) {
				_report('weibo', res.err_msg);
			});
		});
	});
});
</script>

</body>
</html>